<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]
        // let newArr = arr.reduce((prev, cur, index, arr) => {
        //     // prev 前面加起来的和
        //     console.log(prev);

        //     return prev + cur;
        // });
        // console.log(newArr);

        // ----------------------------------------

        let arr = [2, 2, 3]
        let newArr = arr.reduce((prev, cur, index, arr) => {
            console.log(prev, cur);
            // 2 * 2 = 4 
            // 4 * 4 * 4 = 64
            return Math.pow(prev, cur);
        });
        console.log(newArr);
    </script>
</body>

</html>